import json

# 读取第一个文件
with open('/home/llama/llamafactory-examples/train_cf/data/大西瓜籽妈妈.deepseek.chat.cf_new_format copy.json', 'r', encoding='utf-8') as f:
    data1 = json.load(f)
    
# 读取第二个文件
with open('train_cf/src/20250624/pt_data.json', 'r', encoding='utf-8') as f:
    data2 = json.load(f)

# 创建结果列表
result = []

# 添加第二个文件的text内容
for item in data2:
    if 'text' in item:
        result.append({"text": item['text']})

# 添加第一个文件的output内容
for item in data1:
    if 'output' in item:
        result.append({"text": item['output']})

# 写入新文件
with open('train_cf/src/20250624/merged_output.json', 'w', encoding='utf-8') as f:
    json.dump(result, f, ensure_ascii=False, indent=2)